import moment from 'moment';
import { message } from 'antd'
export const checkTime = (data: any) => {
    if (
      moment(data.endTime).format("YYYY-MM-DD HH:mm:ss")
      < moment(data.startTime).format("YYYY-MM-DD HH:mm:ss")
      ) {
      message.error('结束时间不能早于开始时间')
      return false
    }
    return true
}

export const limitTextLen = (text: string,len:number) => {
   if (!text) {
        return Promise.resolve();
    }
    if (text.length <= len) {
      return Promise.resolve();
    } else {
      return Promise.reject(`最多输入${len}字`);
    }
}
